//for adequate results in the diagram, for all the functions used by sleep(3)
#include <stdio.h>
#include<conio.h>
#include<time.h>
#include<windows.h>
#include<iostream>
#include <stdlib.h>
//#include <math.h> //for operations on   long long
using namespace std;

void Sleep(BYTE time) //because the usual sleep not working:(
{
    Sleep((DWORD)time*1000);
    return;
}

void sub(long long a, long long b) //this is VYCHITANIE
{
	long t1,t2;
	t1=clock();
	while (a!=b)
		if (a>b)
			a=a-b;
		else
			b=b-a;
	//unsigned int i=3000;
	//sleep(i);
	 Sleep((BYTE)3);
	t2=clock();
	cout<<"vychitanie time - "<<t2-t1<<"ms"<<endl;
	//cout<<"NOD="<<a;
}

void evcl(  long long a,  long long b) //this is DELENIE
{//in the comments of many experiences with double
	long t1,t2;
	t1=clock();
	while (a!=0 && b!=0)
		if (a>b)
			a=a%b;
			//a = fmod (a,b);
		else
			b=b%a;
			//b = fmod (b,a);
	//unsigned long i=3000;
	//sleep(i);
	Sleep((BYTE)3);
	t2=clock();
	cout<<"delenie time - "<<t2-t1<<"ms"<<endl;
	//cout.setf(ios_base::fixed); //for simple display of number (for double)
    //cout.precision(0);			//for 0 numbers after comma
	//cout<<"NOD="<<a+b;
}

void nvnst( long long a, long long b) //this is NAIVNOST'
{
	 long long c,max,min;
	long t1,t2;
	if (a>=b)
		{
			max=a;
			min=b;
		}
		else
		{
			max=b;
			min=a;
		}
		c=min;
	t1=clock();
	do
	{
		if (max%c==0 && min%c==0)
		{
			//cout<<"NOD="<<c<<endl;
			break;
		}
		else
			c--;
	}
	while (c>0);
	Sleep((BYTE)3);
	t2=clock();
	cout<<"naivnost' time - "<<t2-t1<<"ms"<<endl;
}

int pain()
{
	  long long a,b;
	cout<<endl<<"A:";
	cin>>a;
	cout<<"B:";
	cin>>b;
	nvnst(a,b);
	evcl(a,b);
	sub(a,b);
	return 0;
}

int main()
{
	pain();
	pain();
	pain();
	pain();
	pain();
	cout<<endl<<"Click to exit...";
	getchar();
	getchar();
}